define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'commission.flow/index',
        add_url: 'commission.flow/add',
        edit_url: 'commission.flow/edit',
        delete_url: 'commission.flow/delete',
        export_url: 'commission.flow/export',
        modify_url: 'commission.flow/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', search: false, title: 'id'},
                    {field: 'groupMaster.true_name', search: false, title: '佣金获得者姓名'},
                    {field: 'commission_status', search: 'select', selectList: ["待结算","已结算","已拒绝"], title: '佣金状态'},
                    {field: 'commissionType.commission_desc', search: false, title: '佣金类型描述'},
                    {field: 'get_commission', search: false, title: '所得佣金'},
                    {field: 'settle_time', search: false, title: '结算时间'},
                    {field: 'theOrder.order_no', title: '订单编号'},
                    {field: 'theOrder.order_status', templet:function (d) {
                            if (d.theOrder.order_status == 3){
                                return '已发货'
                            }
                        },search: 'select', selectList: {0:'待付款',1:'代发货',2:'已完成',3:'已发货',4:'退款中'}, title: '订单状态'},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});